package com.lianboke.link.ad.broadcastreceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.lianboke.link.ad.common.CommonParams;
import com.lianboke.link.ad.utils.KLog;

/**
 * 任务定时接受器
 * Created by admin on 2018/1/22.
 */

public class TimerOrderReceiver extends BroadcastReceiver{
    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent==null){
            return;
        }
        try {
            String strAction = intent.getAction();
            KLog.e("time_log", "-------action-------------" + strAction);
            if (CommonParams.TimerParams.TIMER_ORDER_START_ACTION.equals(strAction)) {
                //开始执行定时任务
                Intent intentDownload = new Intent();
                intentDownload.setAction("android.myapp.timer.orders.auto.start");
                intentDownload.putExtra("data", "android.myapp.timer.orders.auto.start");
                context.sendBroadcast(intentDownload);
            }else if(CommonParams.TimerParams.TIMER_ORDER_STOP_ACTION.equals(strAction)){
                //任务全部执行完毕
                Intent intentDownload = new Intent();
                intentDownload.setAction("android.myapp.timer.orders.auto.stop");
                intentDownload.putExtra("data", "android.myapp.timer.orders.auto.stop");
                context.sendBroadcast(intentDownload);
            }
        }catch (Exception e){

        }
    }
}
